package com.thinkgsp.sys.model;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class SysUserDept extends SysModel {

	private static final long serialVersionUID = 5966276454331296885L;
	private Integer id;
	private Integer userId;
	private Integer deptId;
	private Boolean defaultDept;
	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the userId
	 */
	public Integer getUserId() {
		return userId;
	}

	/**
	 * @param userId the userId to set
	 */
	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	/**
	 * @return the deptId
	 */
	public Integer getDeptId() {
		return deptId;
	}

	/**
	 * @param deptId the deptId to set
	 */
	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	/**
	 * @return the defaultDept
	 */
	public Boolean getDefaultDept() {
		return defaultDept;
	}

	/**
	 * @param defaultDept the defaultDept to set
	 */
	public void setDefaultDept(Boolean defaultDept) {
		this.defaultDept = defaultDept;
	}

	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
		sb.append("id",this.id)
		  .append("userId",this.userId)
		  .append("deptId",this.deptId);
		
		return sb.toString();
	}

	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}
		if(!(o instanceof SysUserDept)) {
			return false;
		}
		final SysUserDept ui = (SysUserDept)o;
		if(id != null) {
			return id.equals(ui.getId());
		} else {
			return (userId.equals(ui.getUserId()) && deptId.equals(ui.getDeptId()));
		}
	}

	@Override
	public int hashCode() {
		return (this.id != null ? this.id.hashCode() : 0);
	}

}
